﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace Mall.Member
{
    public partial class Member_Order : System.Web.UI.Page
    {
        public string str_html = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.Models.MemberModels models_member = new BLL.Models.MemberModels();
            BLL.Models.MOrderModels models_order = new BLL.Models.MOrderModels();
            string _username = models_member.CheckUserId();
            string _userid = models_member.GetuserInfoByFiter(" 1=1 and username='" + _username + "' ").Rows[0]["id"].ToString();
            DataTable dt = models_order.AllOrderByFiter("1=1 and userid=" + _userid + " ");
           
            StringBuilder str_html_build = new StringBuilder();

            if (dt.Rows.Count == 0)
            {

                str_html_build.Append("<tr bgcolor='#FFFFFF' height='30'><td align='center' valign='middle'colspan='5' >暂无定单信息</td></tr>");

            }
            else
            {

                foreach (DataRow dr in dt.Rows)
                {

                    str_html_build.Append("<tr bgcolor='#FFFFFF' height='30'><td align='center' valign='middle'>");
                    str_html_build.Append("<a href='/order/order_views.aspx?id=");
                    str_html_build.Append(dr["id"].ToString());
                    str_html_build.Append("'>");
                    str_html_build.Append(dr["ordernum"].ToString());
                    str_html_build.Append("</a></td>");
                    str_html_build.Append("<td colspan='4' align='center' valign='middle' >");
                    str_html_build.Append(dr["ordertime"].ToString());
                    str_html_build.Append("</td></tr>");
                    // str_html_build.Append("</td><td align='center' valign='middle'>");
                    //str_html_build.Append(dr["state"].ToString());
                    //str_html_build.Append("</td><td align=center valign='middle'><a href='myoder.asp?cancel=12012318593519'> ");
                    //str_html_build.Append("取消</a> &nbsp;  <span style='cursor:hand' onclick=\"{if(confirm('该操作不可恢复！\n\n确实删除所选订单吗？ ')){location.href='myoder.asp?Del=12012318593519';}}\"> 删除</a></td></tr>");





                }
            }
            str_html = str_html_build.ToString();
            //TempData["member_order_Listall_html"] = str_html;

        }
    }
}